<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>

	</style>
	<script type="text/javascript">

//获得元旦时间
var oDan = new Date(2017,0,1);
var oTimeDan = oDan.getTime();





setInterval(function(){
							//获得现在时间
							var oNow = new Date();
							var oTimeNow = oNow.getTime();

							//取得时间差
							var sTime = oTimeDan - oTimeNow;


							var sMonth = parseInt(sTime/2592000000);
							var sDay = parseInt(sTime%2592000000/86400000);
							var sHour = parseInt(sTime%86400000/3600000);
							var sMin = parseInt(sTime%3600000/60000);
							var sSec = parseInt(sTime%60000/1000);


							var span = document.getElementsByTagName('span')[0];

							span.innerHTML = '距离元旦还有'+sMonth+'月'+sDay+'天'+sHour+'小时'+sMin+'分钟'+sSec+'秒';


					},1000);




	</script>
</head>
<body>
<span></span>
</body>
</html>